<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="__ADMIN_CSS__/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__ADMIN_CSS__/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__ADMIN_CSS__/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__ADMIN_CSS__/animate.min.css" rel="stylesheet">
    <link href="__ADMIN_CSS__/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="__LAYUIADMIN__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__LAYUIADMIN__/style/admin.css" media="all">
    <script src="__ADMIN_JS__/jquery.min.js?v=2.1.4"></script>
    <script src="__ADMIN_JS__/plugins/iCheck/icheck.min.js"></script>
    <script>
        $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
    </script>
</head>

<body class="gray-bg">
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="ibox-content">
                    <h3>当前位置：营销中心 &raquo; <a class="layui-btn pull-right" href="__CONTROLLER__/index" style="margin-top: -10px">返回上一页 <i class="fa fa-angle-double-right"></i></a></h3>
                </div>
            </div>
        </div>
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <form action="__ACTION__"  class="form-horizontal layui-form" method="post" enctype="multipart/form-data">
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 100px;">真实姓名</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="truename" lay-verify="truename" placeholder="请输入" value="etest" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">&nbsp;</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 100px;">手机号</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="phone" lay-verify="phone" placeholder="请输入" value="13500099922" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">&nbsp;</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 100px;">中奖ID</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="awards_id" lay-verify="awards_id" placeholder="请输入" value="0" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">&nbsp;</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 100px;">第几波抽奖</label>
                                <div class="layui-input-inline">
                                    <input type="number" name="frequency_num" lay-verify="frequency_num" value="0" placeholder="请输入" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">&nbsp;</div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1"><i class="fa fa-check"></i>添加</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__LAYUIADMIN__/layui/layui.all.js"></script>
<script src="__ADMIN_JS__/formValidate.js"></script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer;

        //自定义验证规则
        form.verify({
            name: function(value){
                if(value.length == 0){
                    return '请填写奖项名称';
                }
            },
            info: function(value){
                if(value.length == 0){
                    return '请填写奖品名称';
                }
            },
            sponsor: function(value){
                if(value.length == 0){
                    return '请填写赞助方';
                }
            },
            number_of_winners: function(value){
                if(value.length == 0){
                    return '每一波的中奖人数';
                }
            },
            frequency: function(value){
                if(value.length == 0){
                    return '请填写总抽奖次数';
                }
            }
        });

        //监听提交
        form.on('submit(demo1)', function(data){
            /*layer.alert(JSON.stringify(data.field), {
                name: '最终的提交信息'
            })*/
            /*$.ajax({
                async:true,//或false,是否异步
                type : "POST",
                url : './Awards/checkName',
                dataType : 'json',
                data:{
                    name:'yang',age:25
                },
                success : function(data) {

                    return false;
                }
            });*/
            return true;
        });

    });
</script>
</body>
</html>